package com.example.saifly.inPagePlan.warn;

import com.example.saifly.inPageRecord.RecordModel.BodyData;
import com.example.saifly.inPageRecord.RecordModel.DailyQuestionnaire;
import com.example.saifly.inPageRecord.RecordModel.EnvironmentData;

public class Warn {
    private BodyData bodyData;
    private EnvironmentData environmentData;
    private DailyQuestionnaire dailyQuestionnaire;

    private String message;  //报警短信内容

    public String getMessage()
    {
        return message;
    }

    public void setEnvironmentData(EnvironmentData environmentData)
    {
        this.environmentData=environmentData;
    }

    public void setBodyData(BodyData bodyData)
    {
        this.bodyData=bodyData;
    }
    public void setDailyQuestionnaire(DailyQuestionnaire dailyQuestionnaire)
    {
        this.dailyQuestionnaire=dailyQuestionnaire;
    }

    public String environmentWarn()
    {
        if(environmentData.getHumidity()<30)
        {
            message+="湿度过低，请采取增湿措施";
        }
        else if(environmentData.getHumidity()>80)
        {
            message+="湿度过高，请采取除湿措施";

        }
        if(environmentData.getPm25()>70)
        {
            message+="PM2.5超标，请尽快采取措施，降低室内PM2.5的含量";
        }

        if(environmentData.getTemperature()>35)
        {
            message+="环境温度过高，建议采取降温措施; ";
        }
        else if(environmentData.getTemperature()<15)
        {
            message+="环境温度过d低，建议采取升温措施; ";
        }
        return message;

    }
    public String bodyWarn()
    {
        if(bodyData.getHeartRate()<60)
        {
            message+="心跳过缓，建议去医院就诊; ";
        }
        else if(bodyData.getHeartRate()<60)
        {
            message+="心跳过急，建议去医院就诊; ";

        }

        if(bodyData.getBloodOxygen()<90)
        {
            message+="血氧饱和度过低，建议去医院就诊; ";
        }

        if(bodyData.getBloodOxygenPressure()<80)
        {
            message+="动脉血氧分压过低，建议去医院就诊; ";
        }

        if(bodyData.getBodyTemperature()>38.5)
        {
             message+="您身体发高烧，建议去医院就诊; ";
        }
        else if(bodyData.getBodyTemperature()>37.2)
        {
            message+="您身体发低烧，建议采取措施退烧; ";
        }
        else if(bodyData.getBodyTemperature()<36.3)
        {
            message+="您体温下降，建议去医院就诊; ";
        }

        if(bodyData.getCarbonPressure()>45)
        {
            message+="二氧化碳分压过高，建议去医院就诊; ";
        }
        else if(bodyData.getCarbonPressure()<35)
        {
            message+="二氧化碳分压过低，建议去医院就诊; ";
        }

        if(bodyData.getLowBloodPressure()>90&&bodyData.getHeightBloodPressure()>140)
        {
            message+="您有高血压，建议去医院就诊; ";
        }
        else if(bodyData.getLowBloodPressure()<65)
        {
            message+="您有低血压，建议去医院就诊; ";
        }
        return message;
    }

    public String dailyQuestionnaireWarn()
    {
        if(dailyQuestionnaire.getEnergy()==1||dailyQuestionnaire.getBreathe()==1||
                dailyQuestionnaire.getCough()==1||dailyQuestionnaire.getChest()==1||
                dailyQuestionnaire.getInfluence()==1||dailyQuestionnaire.getSleep()==1
                ||dailyQuestionnaire.getGoout()==1||dailyQuestionnaire.getExpectoration()==1)
        {
            message+="你最近的身体状况很糟糕，请尽快去医院诊治";
        }

        return message;

    }

}
